<script>
import OrgSelect from "@/app_SubCom/orgSelect/index.vue";

export default {
  name: "orgSelectDialog",
  components: {OrgSelect},
  props: {
    visible: {
      type: Boolean,
      default: () => false
    },
    title: {
      type: String,
      default: () => "请选择"
    },
    selectType: {
      type: Array,
      default: () => ["user", "role", "teamRole", "dept", "userGroup", "custom"]
    },
    autoSelection: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {}
  },
  methods: {
    confirmData() {
      let data = this.$refs["os"].getSelectData();
      this.$emit("SelectData", data);
    },
    beforeClose() {
      this.$emit("update:visible", false);
    }
  }
}
</script>

<template>
  <el-dialog :visible.sync="visible"
             :before-close="beforeClose"
             destroy-on-close
             :title="title"
             width="60vw"
             modal-append-to-body
             append-to-body>
    <div style="width: 100%;height: 600px" v-if="visible">
      <org-select ref="os" :selectType="selectType" :autoSelection="autoSelection"></org-select>
    </div>

    <div slot="footer" style="text-align: right">
      <el-button size="small" @click="confirmData" type="primary">确定</el-button>
      <el-button size="small" @click="beforeClose">取消</el-button>
    </div>
  </el-dialog>
</template>

<style scoped>

</style>
